<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:pe="http://primefaces.org/ui/extensions"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Étel Hozzáadása</title>
</h:head>

<h:body>
	<p:fieldset>
		<h:form prependId="false">
			<p:messages autoUpdate="true" closable="true" />
			<h:panelGrid columns="3">
				<p:outputLabel value="Név" for="name" />
				<p:inputText id="name" readonly="#{addFoodDialog.readOnly}"
					label="name" value="#{addFoodDialog.food.name}" />
				<p:message for="name" display="tooltip" />
				<p:outputLabel value="Kalória" for="calorie" />
				<pe:inputNumber id="calorie" readonly="#{addFoodDialog.readOnly}"
					value="#{addFoodDialog.food.calorie}" decimalPlaces="0"
					symbol=" kcal" symbolPosition="s" thousandSeparator=" " />
				<p:message for="calorie" display="tooltip" />
				<p:outputLabel value="Csoport" for="foodgroup" />
				<p:selectOneMenu id="foodgroup"
					value="#{addFoodDialog.food.foodGroup}"
					readonly="#{addFoodDialog.readOnly}" required="true">
					<f:selectItems value="#{foodGroupService.findAll()}" />
					<f:converter binding="#{foodGroupConverter}" />
				</p:selectOneMenu>
				<p:message for="foodgroup" display="tooltip" />
				<p:outputLabel value="Mennyiség" for="uom" />
				<pe:inputNumber id="uom" readonly="#{addFoodDialog.readOnly}"
					value="#{addFoodDialog.food.quantity}" thousandSeparator=" "
					decimalSeparator="," decimalPlaces="2" />
				<p:message for="uom" display="tooltip" />
				<p:outputLabel value="Mértékegység" for="uomType" />
				<p:selectOneMenu id="uomType"
					value="#{addFoodDialog.food.unitOfMeasurement}"
					readonly="#{addFoodDialog.readOnly}">
					<f:selectItems value="#{quantityController.uoms}" />
					<f:converter binding="#{unitOfMeasurementConverter}" />
				</p:selectOneMenu>
				<p:message for="uomType" display="tooltip" />
				<p:outputLabel value="Szénhidrát" for="carbohydrate" />
				<pe:inputNumber id="carbohydrate"
					readonly="#{addFoodDialog.readOnly}"
					value="#{addFoodDialog.food.carbohydrate}" decimalSeparator=","
					decimalPlaces="2" symbol=" gramm" symbolPosition="s"
					thousandSeparator=" " />
				<p:message for="carbohydrate" display="tooltip" />
				<p:outputLabel value="Rost" for="fiber" />
				<pe:inputNumber id="fiber" readonly="#{addFoodDialog.readOnly}"
					value="#{addFoodDialog.food.fiber}" decimalSeparator=","
					decimalPlaces="2" symbol=" gramm" symbolPosition="s"
					thousandSeparator=" " />
				<p:message for="fiber" display="tooltip" />
				<p:outputLabel value="Zsír" for="fat" />
				<pe:inputNumber id="fat" value="#{addFoodDialog.food.fat}"
					readonly="#{addFoodDialog.readOnly}" decimalSeparator=","
					decimalPlaces="2" symbol=" gramm" symbolPosition="s"
					thousandSeparator=" " />
				<p:message for="fat" display="tooltip" />
				<p:outputLabel value="Fehérje" for="protein" />
				<pe:inputNumber id="protein" readonly="#{addFoodDialog.readOnly}"
					value="#{addFoodDialog.food.protein}" decimalSeparator=","
					decimalPlaces="2" symbol=" gramm" symbolPosition="s"
					thousandSeparator=" " />
				<p:message for="protein" display="tooltip" />
				<p:outputLabel value="Glikémiás index" for="glicemicIndex" />
				<pe:inputNumber id="glicemicIndex"
					readonly="#{addFoodDialog.readOnly}"
					value="#{addFoodDialog.food.glicemicIndex}" decimalPlaces="0" />
				<p:message for="glicemicIndex" display="tooltip" />
			</h:panelGrid>
			<p:commandButton value="Mentés" update="@form" id="saveButton"
				rendered="#{addFoodDialog.createButtonRendered}"
				action="#{addFoodDialog.saveFood()}" icon="ui-icon-disk" />
			<p:commandButton value="Mentés" update="@form" id="updateButton"
				rendered="#{addFoodDialog.updateButtonRendered}" icon="ui-icon-disk"
				action="#{addFoodDialog.updateFood()}" />
			<p:commandButton immediate="true" value="Mégse" id="closeButton"
				icon="ui-icon-close" update="@form"
				action="#{addFoodDialog.closeSilently()}" />
			<p:hotkey bind="ctrl+shift+x" immediate="true"
				action="#{addFoodDialog.closeSilently()}" />
		</h:form>
	</p:fieldset>
</h:body>

</html>
